/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modelo;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Francisco
 */
@Entity
@Table(name = "reporte")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Reporte.findAll", query = "SELECT r FROM Reporte r"),
    @NamedQuery(name = "Reporte.findByIdReporte", query = "SELECT r FROM Reporte r WHERE r.idReporte = :idReporte"),
    @NamedQuery(name = "Reporte.findByTodosIngresos", query = "SELECT r FROM Reporte r WHERE r.todosIngresos = :todosIngresos"),
    @NamedQuery(name = "Reporte.findByTodosConsumidores", query = "SELECT r FROM Reporte r WHERE r.todosConsumidores = :todosConsumidores"),
    @NamedQuery(name = "Reporte.findByEstatus", query = "SELECT r FROM Reporte r WHERE r.estatus = :estatus")})
public class Reporte implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_reporte")
    private Integer idReporte;
    @Basic(optional = false)
    @NotNull
    @Column(name = "todos_ingresos")
    private int todosIngresos;
    @Basic(optional = false)
    @NotNull
    @Column(name = "todos_consumidores")
    private int todosConsumidores;
    @Size(max = 1)
    @Column(name = "estatus")
    private String estatus;
    @JoinTable(name = "reporte_ingreso", joinColumns = {
        @JoinColumn(name = "id_reporte", referencedColumnName = "id_reporte")}, inverseJoinColumns = {
        @JoinColumn(name = "id_ingreso", referencedColumnName = "id_ingreso")})
    @ManyToMany
    private List<Ingreso> ingresoList;
    @ManyToMany(mappedBy = "reporteList")
    private List<Consumidor> consumidorList;

    public Reporte() {
    }

    public Reporte(Integer idReporte) {
        this.idReporte = idReporte;
    }

    public Reporte(Integer idReporte, int todosIngresos, int todosConsumidores) {
        this.idReporte = idReporte;
        this.todosIngresos = todosIngresos;
        this.todosConsumidores = todosConsumidores;
    }

    public Integer getIdReporte() {
        return idReporte;
    }

    public void setIdReporte(Integer idReporte) {
        this.idReporte = idReporte;
    }

    public int getTodosIngresos() {
        return todosIngresos;
    }

    public void setTodosIngresos(int todosIngresos) {
        this.todosIngresos = todosIngresos;
    }

    public int getTodosConsumidores() {
        return todosConsumidores;
    }

    public void setTodosConsumidores(int todosConsumidores) {
        this.todosConsumidores = todosConsumidores;
    }

    public String getEstatus() {
        return estatus;
    }

    public void setEstatus(String estatus) {
        this.estatus = estatus;
    }

    @XmlTransient
    public List<Ingreso> getIngresoList() {
        return ingresoList;
    }

    public void setIngresoList(List<Ingreso> ingresoList) {
        this.ingresoList = ingresoList;
    }

    @XmlTransient
    public List<Consumidor> getConsumidorList() {
        return consumidorList;
    }

    public void setConsumidorList(List<Consumidor> consumidorList) {
        this.consumidorList = consumidorList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idReporte != null ? idReporte.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Reporte)) {
            return false;
        }
        Reporte other = (Reporte) object;
        if ((this.idReporte == null && other.idReporte != null) || (this.idReporte != null && !this.idReporte.equals(other.idReporte))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "modelo.Reporte[ idReporte=" + idReporte + " ]";
    }
    
}
